package 多态;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-06-30
 * Time: 11:56
 */
class Shape{
    public void draw(){
        System.out.println("画图形");
    }
}
class Thefireworks extends Shape{
    @Override
    public void draw() {
        System.out.println("🎇");
    }
}
class Smile extends Shape{
    @Override
    public void draw() {
        System.out.println("😊");
    }
}
class Flower extends Shape{
    @Override
    public void draw() {
        System.out.println("💐");
    }
}
public class ShapeTest {
    public static void drawMap(Shape shape) {
        shape.draw();

    }

    public static void main(String[] args) {
        Thefireworks thefireworks = new Thefireworks();
        Smile smile = new Smile();
        Flower flower = new Flower();
        String[] shapes = {"thefireworks", "smile", "flower", "thefireworks", "smile", "flower"};
        for (String shape : shapes) {
            if (shape.equals("thefireworks")) {
                thefireworks.draw();
            } else if (shape.equals("smile")) {
                smile.draw();
            } else if (shape.equals("flower")) {
                flower.draw();
            } else if (shape.equals("thefireworks")) {
                thefireworks.draw();
            } else if (shape.equals("smile")) {
                smile.draw();
            } else if (shape.equals("flower")) {
                flower.draw();
            }
//        drawMap(thefireworks);
//        drawMap(smile);
//        drawMap(flower);

        }
    }
}
